<template>
  <div>
      <div class="parent">
          <!-- v-if判断到底要不要再递归 -->
          <ContentPatent v-if="parent.parent" :parent="parent.parent" @parentReply="reply"></ContentPatent>
      <div class="parent-header">
        <span>{{ parent.user.nickname }}</span>
        <span class="date">{{ parent.create_date |formatDate}}</span>
        <span class='reply' @click="reply(parent)">回复</span>
      </div>
      <div class="parent-body">
        {{ parent.content }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
    name: 'ContentPatent',
  props: {
      parent:Object,
  },
  methods:{
      reply(parent){
          this.$emit("parentReply",parent)
      }
  }
}
</script>

<style lang="less" scoped>
.parent {
  border: 1px solid #f00;
  padding: 5px;
  .parent-header {
    font-size: 12px;
    color: #999;
    display: flex;
    .date {
      margin-left: 10px;
      flex: 1;
    }
    .reply{
         position: relative;
      z-index: 11;
      color:#f00;
    }
  }
  .parent-body {
    font-size: 14px;
    margin: 5px 0;
  }
}
</style>